package com.iccboy.drools;

import com.iccboy.drools.domain.Person;
import com.iccboy.drools.domain.School;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

/**
 * Hello world!
 *
 */
public class RulesHello {
    public static void main( String[] args ) {
        KieServices kss = KieServices.Factory.get();
        KieContainer kc = kss.getKieClasspathContainer();
        KieSession ks = kc.newKieSession("testhelloworld");
        //ks.insert(new Person());
        Person p = new Person("张三", 30);
        ks.insert(p);
        int count = ks.fireAllRules();
        System.out.println("执行后：" + p);
        System.out.println("总共执行了" + count + "条规则");
        ks.dispose();
    }
}
